<template>
  <div>
    <el-menu :default-active="$route.path" @select="handleSelect">
      <el-submenu index="1">
        <template v-slot:title><i class="el-icon-message"></i>缴费</template>
        <el-menu-item-group>
          <el-menu-item v-if="userrole === 'student'|| userrole === 'admin'" index="/payment1">网上缴费</el-menu-item>
          <el-menu-item v-if="userrole === 'office'|| userrole ==='department' || userrole === 'admin'" index="/payment2">现场缴费</el-menu-item>
        </el-menu-item-group>
      </el-submenu>
      <el-submenu v-if="userrole === 'office'|| userrole === 'admin'" index="2">
        <template v-slot:title><i class="el-icon-menu"></i>统计信息</template>
        <el-menu-item-group>
          <el-menu-item index="/onlineFee">网上缴费统计</el-menu-item>
          <el-menu-item index="/offlineFee">现场缴费统计</el-menu-item>
          <el-menu-item index="/totalFee">综合缴费统计</el-menu-item>
          <el-menu-item index="/gChannel">绿色通道办理统计</el-menu-item>
          <el-menu-item index="/advent">报到统计</el-menu-item>
        </el-menu-item-group>
      </el-submenu>
    </el-menu>
  </div>
</template>

<script>
import userManager from "@/UserManager";

export default {
  data(){
    return {
      userrole: userManager.getPermissions()
    };

  },

  methods: {
    handleSelect(key, keyPath) {
        console.log(key);
        this.$router.push(key)
    }
  }
}
</script>